<!-- 教学管理-校园管理-地区资料 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>
          <el-col :span="6">
            <el-form-item label="地区名称">
              <el-input v-model="listQuery.fcatname" placeholder="请输入地区编号或名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="上级地区">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" @click="getlist">查询</el-button>
              <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <el-button type="warning" icon="el-icon-upload2">导入</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FCATNO" label="地区编号" width="105"></el-table-column>
          <el-table-column prop="FCATNAME" label="地区名称"></el-table-column>
          <el-table-column prop="FPARENNO" label="上级地区"></el-table-column>
          <el-table-column prop="FTYPE" label="地区类型"></el-table-column>
          <el-table-column prop="FMEMO" label="备注信息">  </el-table-column>
          <el-table-column prop="FVISIBLE" label="是否显示"  width="95">
            <template slot-scope="scope">
              {{ scope.row.FVISIBLE | dynamicText(fvisiblelist) }}
            </template>
          </el-table-column>
          <el-table-column fixed="left" label="操作" width="150">
            <template slot-scope="scope">
              <el-button @click.native.prevent="insert(scope.row.FCATNO)" icon="el-icon-edit" type="text" size="small">
                编辑
              </el-button>
              <el-popconfirm title="确定删除当前数据吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-delete" style="color: red;margin-left: 10px;"
                  type="text">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" />
        <Form ref="Form" :parelist="list" />
      </div>
    </div>
  </div>
</template>

<script>
  import Form from "./Form.vue"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        fvisiblelist: [
          { id: "1", fullName: "是" },
          { id: "2", fullName: "否" },
        ],
        options3: [{
          value: '20E01',
          label: '北京市'
        }, {
          value: '20E02',
          label: '上海市'
        }, {
          value: '20N01',
          label: '天津市'
        }, {
          value: '20N02',
          label: '重庆市'
        }],

        total: 0,
        list: [
        {
          "FCATNO": "10",
          "FCATNAME": "上海市",
          "FPARENTNO": "",
          "FTYPE":"省",
          "FSEQNO": 28,
          "FVISIBLE": 1,
          "FIMAGE": null,
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        },{
          "FCATNO": "1011",
          "FCATNAME": "黄浦区",
          "FPARENTNO": "上海市",
          "FTYPE":"区",
          "FSEQNO": 28,
          "FVISIBLE": 1,
          "FIMAGE": null,
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        }
        ,{
          "FCATNO": "1012",
          "FCATNAME": "静安区",
          "FPARENTNO": "上海市",
          "FTYPE":"区",
          "FSEQNO": 28,
          "FVISIBLE": 1,
          "FIMAGE": null,
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        }
        ,{
          "FCATNO": "1013",
          "FCATNAME": "徐汇区",
          "FPARENTNO": "上海市",
          "FTYPE":"区",
          "FSEQNO": 28,
          "FVISIBLE": 1,
          "FIMAGE": null,
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        }
        ,{
          "FCATNO": "1014",
          "FCATNAME": "宝山区",
          "FPARENTNO": "上海市",
          "FTYPE":"区",
          "FSEQNO": 28,
          "FVISIBLE": 1,
          "FIMAGE": null,
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        }
        ],
        loading: false,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fcatno: "",
          fcatname: ""
        },
      };
    },
    computed: {},
    created() {
    },
    methods: {
      insert(row) {
        this.$refs.Form.init(row);
      },
    },
  };
</script>